<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>项目签到</title>
    <jsp:include page="../../../main/mp/inc.jsp"	/>
    <script>
        $(function(){
            $("[data-role='navbar']").navbar();
            $("[data-role='header'], [data-role='footer']").toolbar();
        });

        $(function(){

        });

    </script>
</head>
<body>

<div data-role="page" id="page-main" data-theme="a">
    <div data-role="header" data-position="fixed" data-theme="a">
        <h1 style="float:left;margin: 0 10px;"><i class="fa fa-user"></i> 项目签到</h1>
        <a href="#" id="page-comment-action" class="ui-btn ui-btn-right ui-icon-check ui-corner-all ui-btn-icon-left">批注</a>
    </div><!-- header -->
    <div class="ui-content jqm-content jqm-fullwidth" role="main">
        <form id="proSignIn" class="smart-form" novalidate="novalidate" method="post">
            <input type="hidden" name="keyId" id="keyId" value="<s:property value="proSignIn.id" />"/>
            <div class="ui-field-contain">
                <label>项目名称：</label>
                <span><s:property value="proSignIn.proInfo.name"/></span>
            </div>
            <div class="ui-field-contain">
                <label>所在地区：</label>
                <span><s:property value="proArea"/></span>
            </div>
            <div class="ui-field-contain">
                <label>项目地址：</label>
                <span><s:property value="proSignIn.proInfo.address"/></span>
            </div>
            <div class="ui-field-contain">
                <label>签到时间：</label>
                <span><s:date name="proSignIn.createDate" format="yyyy-MM-dd hh:mm"/></span>
            </div>
            <div class="ui-field-contain">
                <label>签到人：</label>
                <span><s:property value="proSignIn.creater.name"/></span>
            </div>
            <div class="ui-field-contain">
                <label>签到地址：</label>
                <span><s:property value="address"/></span>
            </div>
            <div class="ui-field-contain">
                <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
                    <table>
                        <tr><td><label>考勤状态：</label></td></tr>
                        <tr><td>
                            <label for="statusY">正常</label>
                            <input disabled type="radio" name="status" id="statusY" class="custom" value="1" <s:property value="proSignIn.status==1?'checked':''" /> />
                            <label for="statusN">迟到</label>
                            <input disabled type="radio" name="status" id="statusN" class="custom" value="0" <s:property value="proSignIn.status==0?'checked':''" /> />
                        </td></tr>
                    </table>
                </fieldset>
            </div>
        </form>
    </div><!-- /content -->
    <%--<div data-role="footer" data-position="fixed" data-theme="a">
        <div data-role="navbar" data-iconpos="top" >
            <div data-role="footer" data-position="fixed" data-theme="a">
                <div data-role="navbar" data-iconpos="top" >
                    <ul>
                        <li><a key="page-main-action" data-ajax="false" data-icon="calendar">基本信息</a></li>
                        <li><a key="page-comment-action"  data-icon="comment">批注信息</a></li>
                    </ul>
                </div><!-- /navbar -->
            </div><!-- /footer -->
        </div><!-- /navbar -->
    </div><!-- /footer -->--%>

</div>

<!-- 页面批注-->
<div data-role="page" id="page-comment" data-theme="a"
     targetId="<s:property value="proSignIn.id" />"
     targetObject="com.joint.core.entity.ProSignIn"
     data="{}" createrId="<s:property value="proSignIn.creater.id" />">
    <div data-role="header"  >
        <a href="#" key="page-main-action" data-ajax="false" id=""
           class="ui-btn ui-btn-left ui-icon-back ui-corner-all ui-btn-icon-left ui-btn-icon-notext">返回</a>
        <h1>批注信息</h1>
        <a href="#" key="comment-popup2" data-rel="popup" parentId=''
           createrName='<s:property value="proSignIn.creater.name"/> 请填写批注信息'
           createrId='<s:property value="proSignIn.creater.id"/>' data-transition="pop"
           class="ui-btn ui-btn-right ui-icon-comment ui-corner-all ui-btn-icon-left ui-btn-icon-notext"
           data-position-to="window" data-icon="comment" data-prefetch="true">发表批注</a>
    </div><!-- /header -->
    <div role="main" class="ui-content" id="comment-listview-content"
         mp-url="ajax-comment!listDocument.action?keyId=<s:property value="proSignIn.id" />">
        <ul data-role="listview" data-theme="a" data-dividertheme="b"
            mp-page="1" mp-keyword="" data-split-icon="forward" data-split-theme="a" data-inset="false">
            <li><a data-ajax="false"  href="javascript:void(0)">
                没有批注信息.
            </a>
            </li>
        </ul>
        <hr/>
        <div>
            <a href="#" key="prePage" class="ui-btn ui-btn-icon-notext ui-corner-all  ui-mini ui-btn-inline ui-icon-carat-l "> 上一页</a>
            <a href="#" key="nextPage" class="ui-btn ui-btn-icon-notext ui-corner-all  ui-mini ui-btn-inline ui-icon-carat-r ">下一页 </a>
                    <span class="ui-btn-inline">
                        页数  <span key="pageNumber"></span>/<span key="pageCount"></span> 共<span key="totalCount"></span>条
                    </span>
        </div>
        <div data-role="popup" id="comment-popup2" data-theme="a" class="ui-corner-all" data-history="false" data-corners="false">
            <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-left">Close</a>
            <form>
                <div style="padding:0 8px;">
                    <textarea cols="40" rows="8" name="comment" placeholder="请填写您的批注信息"></textarea>
                    <button type="button" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">提交批注</button>
                             </div>
            </form>
        </div>
    </div><!-- /content -->
</div><!-- /page comment -->

</body>
</html>

<script>

    $(function(){
        //批注页面
        $("a#page-comment-action,a[key='page-comment-action']").off("click").on("click",function(){
            $(':mobile-pagecontainer').pagecontainer('change', '#page-comment',{changeHash: false,reverse: true,transition:'slidedown'});
            loadListview($("#comment-listview-content"),{},function(rdata){
                $("a[key=comment-popup2]").unbind('click').bind("click",function(e){
                    $( "#comment-popup2" ).data("parentId",$(this).attr("parentId")).data("createrId",$(this).attr("createrId"));
                    $( "#comment-popup2 textarea" ).attr("placeholder","@"+$(this).attr("createrName"));
                    $( "#comment-popup2" ).popup( "open", {transition:'pop',positionTo:'window'} );
                })
            })
        })
        //发表批注对话框的提交按钮
        $("#comment-popup2 button").bind("click",function(e){
            //隐藏popup
            var parentId = $( "#comment-popup2" ).data("parentId");
            var createrId = $( "#comment-popup2" ).data("createrId");
            var text = $( "#comment-popup2 textarea" ).val();

            var targetId = $("#page-comment").attr("targetId");
            var targetObject = $("#page-comment").attr("targetObject");
            //alert(parentId + " " + createrId + " " + text + " " + targetId + " " + targetObject);
            sendComment(parentId,createrId,text,targetId,targetObject,function(){

            });
        })
        //详情页面
        $("a[key='page-main-action']").click(function(){
            $(':mobile-pagecontainer').pagecontainer('change', '#page-main',{changeHash: false,reverse: true,transition:'slideup'});
        })
    })

</script>